const service = require("../service/aset.article.service");
class LabelController {
  async create(ctx, next) {
    try {
      const { title, author, content, keywords, desc, category_id } =
        ctx.request.body;
      const result = await service.create(
        title,
        author,
        content,
        keywords,
        desc,
        category_id
      );
      ctx.body = result;
    } catch (error) {
      console.log(error);
    }
  }

  async update(ctx, next) {
    const { id, title, author, content, keywords, desc, category_id } =
      ctx.request.body;
    const result = await service.update(
      id,
      title,
      author,
      content,
      keywords,
      desc,
      category_id
    );
    ctx.body = result;
  }
  async managerList(ctx, next) {
    const { status, category_id, page, pageSize,  keywords } =
      ctx.request.body;
    const result = await service.managerList(status, category_id, page, pageSize, keywords);
    ctx.body = result;
  }
  async clientList(ctx, next) {
    const { category_id, page, pageSize,  keywords } =
      ctx.request.body;
    const result = await service.clientList( category_id, page, pageSize, keywords);
    ctx.body = result;
  }

  async remove(ctx, next) {
    const { id } = ctx.request.body;
    const result = await service.remove(id);
    ctx.body = result;
  }
}

module.exports = new LabelController();
